import type { GoodsResult } from '@/types/goods'
import { http } from '@/utils/http'

/**
 * 商品详情
 * @param id 商品id
 */
export const getGoodsByIdAPI = (id: string) => {
  return new Promise((resolve, _) => {
    setTimeout(() => {
      resolve({
        result: {
          "id": "3995885",
          "name": "小程序/H5商城/桌面系统定制开发",
          "spuCode": "3995885",
          "desc": "定制开发小程序,H5,桌面系统",
          "price": "648.00",
          "oldPrice": "1499.00",
          "discount": 1.00,
          "inventory": 10240,
          "brand": {
            "id": "spider99999999999",
            "name": "阿法机",
            "nameEn": "alphabot",
            "logo": "https://www.alphabot.center/content/images/demo/default-avatar.png",
            "picture": "https://www.alphabot.center/content/images/logo.png",
            "type": null,
            "desc": null,
            "place": null
          },
          "salesCount": 408,
          "commentCount": 0,
          "collectCount": 1,
          "mainVideos": [],
          "videoScale": 1,
          "mainPictures": [
            "https://www.alphabot.center/content/images/demo/prod-shop01.jpg",
            "https://www.alphabot.center/content/images/demo/prod-task01.jpg",
            "https://www.alphabot.center/content/images/demo/prod-employee01.jpg",
            "https://www.alphabot.center/content/images/demo/prod-shipping01.jpg",
          ],
          "specs": [
            {
              "name": "版本",
              "id": "1482369432363859971",
              "values": [
                {
                  "name": "基础版",
                  "picture": null,
                  "desc": "只有基础功能,没有售后"
                },
                {
                  "name": "完整版",
                  "picture": null,
                  "desc": "全功能,有售后"
                },
                {
                  "name": "定制版",
                  "picture": null,
                  "desc": "全功能,可定制,有售后"
                }
              ]
            }
          ],
          "skus": [
            {
              "id": "300247710",
              "skuCode": "300247710",
              "price": "648.00",
              "oldPrice": "1499.00",
              "inventory": 408,
              "picture": "https://www.alphabot.center/content/images/demo/prod-shop01.jpg",
              "specs": [
                {
                  "name": "版本",
                  "valueName": "基础版"
                }
              ]
            },
            {
              "id": "300247711",
              "skuCode": "300247710",
              "price": "6480.00",
              "oldPrice": "9072.00",
              "inventory": 408,
              "picture": "https://www.alphabot.center/content/images/demo/prod-task01.jpg",
              "specs": [
                {
                  "name": "版本",
                  "valueName": "完整版"
                },
              ]
            },
            {
              "id": "300247711",
              "skuCode": "300247710",
              "price": "7920.00",
              "oldPrice": "15840.00",
              "inventory": 408,
              "picture": "https://www.alphabot.center/content/images/demo/prod-shipping01.jpg",
              "specs": [
                {
                  "name": "版本",
                  "valueName": "定制版"
                },
              ]
            }
          ],
          "categories": [
            {
              "id": "109264007",
              "name": "定制开发",
              "layer": 2,
              "parent": {
                "id": "1005002",
                "name": "小程序/桌面系统",
                "layer": 1,
                "parent": null
              }
            },
            {
              "id": "1005002",
              "name": "程序开发",
              "layer": 1,
              "parent": null
            }
          ],
          "details": {
            "pictures": [
              "https://www.alphabot.center/content/images/demo/prod-shop01.jpg",
              "https://www.alphabot.center/content/images/demo/prod-shop02.jpg",
              "https://www.alphabot.center/content/images/demo/prod-task01.jpg",
              "https://www.alphabot.center/content/images/demo/prod-task02.jpg",
              "https://www.alphabot.center/content/images/demo/prod-employee01.jpg",
              "https://www.alphabot.center/content/images/demo/prod-employee02.jpg",
              "https://www.alphabot.center/content/images/demo/prod-shipping01.jpg",
              "https://www.alphabot.center/content/images/demo/prod-shipping02.jpg",
            ],
            "properties": []
          },
          "isPreSale": false,
          "isCollect": null,
          "recommends": null,
          "userAddresses": null,
          "similarProducts": [{
            id: '1',
            name: '快速商城框架(小程序/H5)',
            desc: '',
            price: 6480.00,
            picture: 'https://www.alphabot.center/content/images/demo/prod-shop01.jpg',
            orderNum: 1
          }, {
            id: '2',
            name: '社交广场类应用(小程序/H5)',
            desc: '',
            price: 9072.00,
            picture: 'https://www.alphabot.center/content/images/demo/prod-task01.jpg',
            orderNum: 2
          }, {
            id: '3',
            name: 'CMS人员管理(桌面版)',
            desc: '',
            price: 3960.00,
            picture: 'https://www.alphabot.center/content/images/demo/prod-employee01.jpg',
            orderNum: 3
          }, {
            id: '4',
            name: '管理系统定制(桌面版)',
            desc: '',
            price: 7920.00,
            picture: 'https://www.alphabot.center/content/images/demo/prod-shipping01.jpg',
            orderNum: 4
          }],
          "hotByDay": [

          ],
          "evaluationInfo": null
        }
      })
    }, 1200);
  })
  // return http<GoodsResult>({
  //   method: 'GET',
  //   url: '/goods',
  //   data: { id },
  // })
}
